package org.wkg.lesson02;

public class Demo_208 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            while (!Thread.currentThread().isInterrupted()) {
                System.out.println("hello thread....");
            }
            System.out.println("线程退出....");
        });
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());
        thread.start();
        Thread.sleep(1000);
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());
        thread.interrupt();
        Thread.sleep(100);
        System.out.println(thread.getName() + " :isAlive: " + thread.isAlive());

    }
}
